package org.yonggan.web.util;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;

/**
 * Created by Administrator on 2018/1/5.
 */
public class Test {

    public static void main(String[] args) throws ExecutionException {

        Cache<String ,Long> lastModifiedCache   = CacheBuilder.newBuilder()
                .expireAfterWrite(10, TimeUnit.SECONDS).build();

        Long aLong = lastModifiedCache.get("lastModified", System::currentTimeMillis);
        System.out.println(aLong);

    }
}
